package cn.sofwin.day0118.game;

import java.util.Scanner;

/**
 * 游戏
 */
public class Game {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        Monster buff = new Monster();
        //创建英雄
        Hero h = new Hero();
        h.exp = 0;
        h.rank = 1;
        h.atk = 500;

        System.out.println("请选择buff等级：");
        int rank = sc.nextInt();
        buff.rank = rank;
        buff.hp = buff.rank * 1000;


        while (true) {
            System.out.println("是否攻击？y/n");//通过选择y进行攻击
            String option = sc.nextLine();
            if (buff.hp < 0 || "n".equals(option)) {
                if (buff.hp < 0) {
                    h.exp += 100 * buff.rank;
                    System.out.println("恭喜你已击败buff！");
                    if (h.exp % 500 == 0) {
                        h.rank++;
                        System.out.println("恭喜等级提升！等级为：" + h.rank);
                    }

                } else {
                    System.out.println("已停止攻击");
                }
                break;
            } else {
                h.attack(buff);
            }

        }


    }
}
